<template>
  <div>
    <van-cell-group>
      <van-cell
        v-for="item in list"
        :key="item.cinemaId"
        :title="`${item.districtName} - ${item.name}`"
        :value="formatValue(item)"
        :label="item.address"
        @click="emit('click', item)"
      />
    </van-cell-group>

    <van-empty v-show="list.length === 0" description="暂无满足条件的数据" />
  </div>
</template>

<script lang="ts" setup>
defineProps<{
  list: ICinema[]
}>()

const emit = defineEmits(['click'])

function formatValue(item: ICinema) {
  // 展示价格
  // return item.lowPrice

  // @ts-ignore 展示距离
  return item.distance === '距离未知' ? '距离未知' : item.distance + 'km'
}

// onMounted(() => {
//   navigator.geolocation.getCurrentPosition((postion) => {
//     console.log('success', postion)
//   })
// })
</script>
